package com.cgbg.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cgbg.pojo.Category;
import com.cgbg.service.CategoryService;
import com.cgbg.mapper.CategoryMapper;
import com.cgbg.vo.CategoryVo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * @author 城管不管
 * @description 针对表【tb_category】的数据库操作Service实现
 * @createDate 2025-10-18 19:58:33
 */
@Service
@RequiredArgsConstructor
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category>
        implements CategoryService {

    private final CategoryMapper categoryMapper;

    @Override
    public CategoryVo findCategoryById(Long categoryId) {
        Category category = categoryMapper.selectById(categoryId);
        CategoryVo categoryVo = new CategoryVo();
        BeanUtils.copyProperties(category, categoryVo);
        categoryVo.setId(String.valueOf(category.getId()));
        return categoryVo;
    }
}




